{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[-0.00608079, -0.99922527, 0.03888293, 0.04046097], [0.99989499, -0.00658716, -0.01290818, -0.00346137], [0.01315431, 0.03880036, 0.9991604, -0.06367991], [0.0, 0.0, 0.0, 1.0]]\n"
     ]
    }
   ],
   "source": [
    "mylines = []\n",
    "with open ('results-imucam-data.txt', 'rt') as myfile:  # Open lorem.txt for reading text\n",
    "    for line in myfile:\n",
    "        #print(line)\n",
    "        mylines.append(line)\n",
    "        \n",
    "for i in range(len(mylines)):\n",
    "    if mylines[i][0:12]==\"Reprojection\":\n",
    "        err_str = mylines[i].split(',')[0].split(' ')\n",
    "        err = float(err_str[len(err_str)-1])\n",
    "            \n",
    "    if mylines[i][0:4]==\"T_ci\":\n",
    "        ext_lines = mylines[i+1:i+5]\n",
    "        \n",
    "\n",
    "for i in range(len(ext_lines)):\n",
    "    ext_lines[i] = ext_lines[i].rstrip().strip(\"[]\").strip(\" [ \").split()\n",
    "    for j in range(len(ext_lines[i])):\n",
    "        ext_lines[i][j] = float(ext_lines[i][j])\n",
    "    \n",
    "print(ext_lines)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0.128133978857\n"
     ]
    }
   ],
   "source": [
    "print(err)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
